package com.boliq.demo.day4;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.HashMap;
import java.util.Map;

/**
 * <pre>
 * ================================================
 * 作者: BLQ_SSNB
 * 日期：2021/3/4
 * 邮箱: blq_ssnb@outlook.com
 * 修改次数: 1
 * 描述:
 *      添加描述
 * ================================================
 * </pre>
 */
public class HomeVpAdapter extends FragmentPagerAdapter {

    private Map<Integer,Fragment> data;

    public HomeVpAdapter(@NonNull FragmentManager fm) {
        super(fm);
        data = new HashMap<>();
        data.put(0,new FirstHomeFragment());
        data.put(1,new SecondHomeFragment());
        data.put(2,new ThreeHomeFragment());
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return data.get(position);
    }

    @Override
    public int getCount() {
        return 3;
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return "标签"+position;
    }
}
